<template>
	<view class="fixedRight" @tap="openCustomerServiceChat"><image src="/static/consult.png" mode="widthFix"></image></view>
</template>

<script>
export default {
	name: 'contact',
	data() {
		return {
			kfPath: ''
		};
	},
	created() {
		this.getConfigkf();
	},
	methods: {
		getConfigkf() {
			let code = 'wxkf';
			this.$getajax(this.$api.getkfInfo, { code }).then(da => {
				if (da.code == 200) {
					this.kfPath = da.data.name;
				}
			});
		},
		openCustomerServiceChat() {
			if (!this.kfPath) {
				return;
			}
			wx.openCustomerServiceChat({
				extInfo: { url: this.kfPath },
				corpId: 'wwbcc26e8b6e085198',
				success(res) {
					console.log('zhel');
				},
				fail(res) {
					console.log(res);
				}
			});
		}
	}
};
</script>

<style scoped lang="less">
.fixedRight {
	position: fixed;
	right: 0;
	top: 45%;
	z-index: 999;
	image {
		width: 172upx;
		height: 211upx;
	}
}
</style>
